In [1]:
from sympy import *
init_printing() #muestra símbolos más agradab
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
import numpy as np
R=lambda n,d: Rational(n,d)
In [2]:
x,y,epsilon=symbols('x,y,epsilon',real=true)
xc,yc=symbols('\hat{x},\hat{y}')
xi,eta=symbols('xi,eta')
C=symbols('C')
simetrias=(x+epsilon,y)
xi=simetrias[0].diff(epsilon).subs(epsilon,0)
eta=simetrias[1].diff(epsilon).subs(epsilon,0)
xi, eta
yaux=integrate(eta/xi,y)+C
r=solve(y-yaux,C)[0]
s=integrate(1/(xi),x).subs(y,r)
r, s
Out[2]:
In [3]:
#VERIFICAMOS QUE SEAN CANONICAS
(r,s), (r.subs(x,simetrias[0]).subs(y,simetrias[1]),s.subs(x,simetrias[0]).subs(y,simetrias[1]))
Out[3]:
In [4]:
simetrias=(exp(epsilon)*x,y)
xi=simetrias[0].diff(epsilon).subs(epsilon,0)
eta=simetrias[1].diff(epsilon).subs(epsilon,0)
xi, eta
yaux=integrate(eta/xi,y)+C
r=solve(y-yaux,C)[0]
s=integrate(1/(xi),x)
r, s
Out[4]:
In [5]:
#VERIFICAMOS QUE SEAN CANONICAS
(r,s), (r.subs(x,simetrias[0]).subs(y,simetrias[1]),s.subs(x,simetrias[0]).subs(y,simetrias[1]))
Out[5]:
In [6]:
xc=x/(1-epsilon*x)
yc=y/(1-epsilon*x)
simetrias=(xc,yc)
xi=simetrias[0].diff(epsilon).subs(epsilon,0)
eta=simetrias[1].diff(epsilon).subs(epsilon,0)
xi, eta
Out[6]:
In [7]:
#entontramos r
z=Function('z')(x)
dsolve(Eq(z.diff(x),z/x),z)
#r=y/x
r=y/x
s=integrate(1/(xi),x)
r,s
Out[7]:
In [8]:
#VERIFICAMOS QUE SEAN CANONICAS
rr=r.subs(y,yc).subs(x,xc)
ss=s.subs(y,yc).subs(x,xc).simplify()
r, s, rr, ss
Out[8]:
In [9]:
x,y,epsilon=symbols('x,y,epsilon')
xc,yc=symbols('\hat{x},\hat{y}')
xi,eta=symbols('xi,eta')
C=symbols('C')
xc=cos(epsilon)*x-sin(epsilon)*y
yc=sin(epsilon)*x+cos(epsilon)*y
simetrias=(xc,yc)
xi=simetrias[0].diff(epsilon).subs(epsilon,0)
eta=simetrias[1].diff(epsilon).subs(epsilon,0)
xi, eta
Out[9]:
In [10]:
#buscamos r
z=Function('z')(x)
ecuacion=Eq(z.diff(x)+x/z,0)
zz=dsolve(ecuacion,z)
y=symbols('y')
r=sqrt(x**2+y**2)
r
r0=symbols('r',positive=true)
s=integrate(-1/sqrt(r0**2-x**2),x)
r, s
#RESUELVO SÓLO CON LA COMPU
#ecuacion=Eq(y.diff(x)-eta/xi,0)
#ecuacion
#r=dsolve(ecuacion,y)
#r
#s=integrate(1/(r[1].rhs),x)
#r,s
##########################################
#yaux=integrate(eta/xi,y)+C
#r=solve(y-yaux,C)[0]
#xi,eta,yaux
#s=integrate(1/(xi),x).subs(y,r)
#r,s
Out[10]:
In [11]:
zz
Out[11]:
In [12]:
#VERIFICAMOS QUE SEAN CANONICAS
rr=r.subs(y,yc).subs(x,xc)
ss=s.subs(y,yc).subs(x,xc).simplify()
r**2, s, rr**2, ss
Out[12]:
In [13]:
x,y,epsilon=symbols('x,y,epsilon',real=true)
xc,yc=symbols('\hat{x},\hat{y}')
xi,eta=symbols('xi,eta')
C=symbols('C')
sin(epsilon+atan(x))/(cos(epsilon+atan(x)))
(sin(epsilon)*cos(atan(x))+cos(epsilon)*sin(atan(x)))/(cos(epsilon)*cos(atan(x))-sin(epsilon)*sin(atan(x))).simplify().factor()
y/((cos(epsilon)*cos(atan(x))-sin(epsilon)*sin(atan(x)))*sqrt(1+x**2)).expand()
Out[13]:
In [14]:
x,y,epsilon=symbols('x,y,epsilon')
xc,yc=symbols('\hat{x},\hat{y}')
xi,eta=symbols('xi,eta')
C=symbols('C')
y=Function('y')(x)
xc=cos(epsilon)*x-sin(epsilon)*y
yc=sin(epsilon)*x+cos(epsilon)*y
simetrias=(xc,yc)
simetrias
exp0=(yc.diff(x)/xc.diff(x)).subs(y.diff(x),y/x)
y=symbols('y')
(exp0.subs(y(x),y)).factor()
Out[14]:
Ejercicio 1.2
In [15]:
x,y,epsilon=symbols('x,y,epsilon',real=true)
Y=Function('Y')(x)
sol=dsolve(Eq(Y.diff(x)-(1-Y**2)/x),Y)
sol
Out[15]:
Ejercicio 1.5
In [16]:
f=3*y/x+x**5/(x**3+2*y)
y=Function('y')(x)
r=y/x**3
s=log(x)
r, s
exp0=s.diff(x)/r.diff(x)
exp1=exp0.subs(y.diff(x), f)
exp1.expand()
Out[16]:
Ejercicio 1.6
In [17]:
a,b,c,d=symbols('a,b,c,d',real=true)
x,y=symbols('x,y',real=true)
#f=exp(-x)*y**2+y+exp(x)
xi=a*x+b*y
eta=c*x+d*y
xi, eta
f=exp(-x)*y**2+y+exp(x)
expr0=eta.diff(x)+(eta.diff(y)-xi.diff(x))*f-xi.diff(y)*f**2-xi*f.diff(x)-eta*f.diff(y)
expr1=expr0.expand().factor().collect(exp(x))
expr1, f
Out[17]:
Ejercicio 2.2
In [18]:
#SUPONEMOS x>0 y>0
#CALCULAMOS r Y s
#y>0 x>0
y=symbols('y',positive=true)
x=symbols('x',positive=true)
r=y**2/x+x
#r
s=-1/r*sqrt((r-x)/x)
#r.factor(),s.expand()
r,s.factor()
Out[18]:
In [19]:
#resolvemos la ecuacion de las coordenadas canónicas para encontrar las simetrías ( es decir xc e yc)
#reiniciamos el valor de x,y,xc,yc por las dudas que tengan otros valores que prvengan de otros ejercicios
xc,yc=symbols('\hat{x},\hat{y}')
eq1=Eq(r.subs(x,xc).subs(y,yc),r)
eq2=Eq(s.subs(x,xc).subs(y,yc),s+epsilon)
sol=solve([eq1,eq2],[xc,yc])
sol
Out[19]:
In [20]:
#VERIFICAMOS QUE SON REALMENTE LAS SIMETRÍAS
sol[0][0].diff(epsilon).subs(epsilon,0), sol[0][1].diff(epsilon).subs(epsilon,0)
Out[20]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]: